<p id="notice"><%= notice %></p>

<h1>文章列表</h1>

<table class="table">
  <thead>
    <tr>
      <th>标题</th>
      <th>历史版本</th>
      <th colspan="3">操作</th>
    </tr>
  </thead>

  <tbody>
    <% @posts.each do |post| %>
      <tr>
        <td><%= post.title %></td>
        <td>
          <% if post.versions.count > 0 %>
          <select class="form-control">
            <% post.versions.each do |p| %>
            <option><%= l p.version %></option>
            <% end %>
          </select>
          <% end %>
        </td>

        <td><%= link_to 'Show', post %></td>
        <td><%= link_to 'Edit', edit_post_path(post) %></td>
        <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Post', new_post_path %>
